/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.lang.annotation.*;

/**
 * <p>Project: app2022 - MyDemo
 * <p>Powered by webrx On 2022-02-09 11:21:26
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class MyDemo {
    public static void main(String[] args) {
        new MyDemo().work();
    }

    @FileType(".java")
    @FileType(".html")
    @FileType(".css")
    @FileType(".js")
    @FileType
    public void work() {
        try {
            FileType[] fileTypes = this.getClass().getMethod("work").getAnnotationsByType(FileType.class);
            System.out.println("将从如下后缀名的文件中查找文件内容");
            for (FileType fileType : fileTypes) {
                System.out.println(fileType.value());
            }
            System.out.println("查找过程略。。。");
        } catch (NoSuchMethodException | SecurityException e) {
            e.printStackTrace();
        }
    }

    @Target({ElementType.METHOD, ElementType.TYPE})
    @Retention(RetentionPolicy.RUNTIME)
    public @interface FileTypes {
        FileType[] value();
    }

    @Target({ElementType.METHOD, ElementType.TYPE})
    @Retention(RetentionPolicy.RUNTIME)
    @Repeatable(FileTypes.class)
    public @interface FileType {
        String value() default ".class";
    }
}
